package com.effectiv.gooruda.rest.service.api;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import com.effectiv.gooruda.rest.docs.annotation.Api;
import com.effectiv.gooruda.rest.docs.annotation.ApiHeader;
import com.effectiv.gooruda.rest.docs.annotation.ApiHeaders;
import com.effectiv.gooruda.rest.docs.annotation.ApiMethod;
import com.effectiv.gooruda.rest.docs.annotation.ApiParam;
import com.effectiv.gooruda.rest.docs.annotation.ApiResponseObject;
import com.effectiv.gooruda.rest.docs.pojo.ApiVerb;

@Path("/twitter/block")
@Api(name = "Twitter - Block/Unblock User API", description = "Operations for blocking and unblocking twitter users.")
public abstract class TwitterBlockService {

	/**
	 * Blocks a user.
	 * 
	 * @param userId
	 * @return
	 */

	@ApiMethod(path = "/api/twitter/block/{provider}/{userId}", verb = ApiVerb.POST, description = "Blocks a user by id.If a friendship exists with the user, it will be destroyed. ", produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })
	@POST
	@Produces(MediaType.APPLICATION_JSON)
	@Path("/{provider}/{userId}")
	public abstract @ApiResponseObject
	Response block(
			@PathParam("provider") @ApiParam(name = "provider", description = "Twitter identifier for the application.") String provider,
			@PathParam("userId") @ApiParam(name = "userId", description = "ID of the user to block.") long userId);

	/**
	 * Blocks a user by screename
	 * 
	 * @param screenName
	 * @return
	 */

	@ApiMethod(path = "/api/twitter/block//{provider}/{screenName}", verb = ApiVerb.POST, description = "Blocks a user by screen name.If a friendship exists with the user, it will be destroyed. ", produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })
	@POST
	@Produces(MediaType.APPLICATION_JSON)
	@Path("/{provider}/{screenName}")
	public abstract @ApiResponseObject
	Response block(
			@PathParam("provider") @ApiParam(name = "provider", description = "Twitter identifier for the application.") String provider,
			@PathParam("screenName") @ApiParam(name = "screenName", description = "Screen name of the user to block.") String screenName);

	/**
	 * Get all blocked users
	 * 
	 * @return
	 */
	@ApiMethod(path = "/api/twitter/block/{provider}", verb = ApiVerb.GET, description = "Retrieves a list of blocked users. ", produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })
	@GET
	@Produces(MediaType.APPLICATION_JSON)
	@Path("/{provider}")
	public abstract @ApiResponseObject
	Response getBlockedUsers(
			@PathParam("provider") @ApiParam(name = "provider", description = "Twitter identifier for the application.") String provider);

	/**
	 * Unblock an user.
	 * 
	 * @param userId
	 * @return
	 */

	@ApiMethod(path = "/api/twitter/block/{provider}/{userId}/unblock", verb = ApiVerb.POST, description = "Un-blocks a user by id.", produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })
	@POST
	@Produces(MediaType.APPLICATION_JSON)
	@Path("/{provider}/{userId}/unblock")
	public abstract @ApiResponseObject
	Response unblock(
			@PathParam("provider") @ApiParam(name = "provider", description = "Twitter identifier for the application.") String provider,
			@PathParam("userId") @ApiParam(name = "userId", description = "ID of the user to block.") long userId);

	/**
	 * Unblock an user by screen name
	 * 
	 * @param screenName
	 * @return
	 */
	@ApiMethod(path = "/api/twitter/block/{provider}/{screenName}/unblock", verb = ApiVerb.POST, description = "Un-blocks a user by id.", produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })
	@POST
	@Produces(MediaType.APPLICATION_JSON)
	@Path("/{provider}/{screenName}/unblock")
	public abstract @ApiResponseObject
	Response unblock(
			@PathParam("provider") @ApiParam(name = "provider", description = "Twitter identifier for the application.") String provider,
			@PathParam("screenName") @ApiParam(name = "screenName", description = "Screen Name of the user to block.") String screenName);

}
